home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / asm / ESA.readme < prev    next >
Text File  |  2002-10-26  |  2KB  |  52 lines

  1. Short:    Extended Syntax Assembly 1.15
  2. Author:   bevilacq@cli.di.unipi.it (Simone Bevilacqua)
  3. Uploader: bevilacq@cli.di.unipi.it (Simone Bevilacqua)
  4. Type:     dev/asm
  5. Requires: 020+ CPU, KS 2.04
  6. Replaces: dev/asm/ESA.lha
  7.  
  8. Ever heard of "inline assembly" inside C, Pascal, etc. ?
  9. Well, now we can have "inline C, Pascal, etc." inside assembly!
  10.  
  11. Look below: that's a small sample of ESA code!!!
  12.  
  13.  
  14.  
  15. *******************************************************************************
  16. * CpyQtdStr
  17. *******************************************************************************
  18. * INFO           copies a string enclosed between two quotes.
  19. * SYN            StrEnd = CpyQtd[StrPtr,DstBufAdr]
  20. *                d0.l            a0.l   a1.l
  21. * IN             StrPtr      pointer to string
  22. *                DstBufAdr   address of destination buffer
  23. * OUT            StrEnd      pointer to last character (NULL); 0 if ERROR!
  24. * WARN           be careful there is *no* check!!!
  25. * NOTE           - the first char of the string is considered the quote
  26. *                - the copy is NULL-terminated;
  27. *                - fails at the first NEWLINE or BLANK
  28. *******************************************************************************
  29.  
  30.                 function CpyQtdStr[a0-a1],d1/a0-a1:d0.l
  31.  
  32.                 move.b       (a0)+,d0                 ;get "quote"
  33.                 repeat
  34.                  move.b      (a0)+,d1                 ;get first char
  35.  
  36.                  switch.s d1.b
  37.                  -> d0                                ;successful copy
  38.                   clr.b      (a0)                     ;NULL-termination
  39.                   moveq.l    #0,d1                    ;exit loop
  40.                  -> #0                                ;unvalid character, exit loop
  41.                   suba.l     a0,a0                    ;error
  42.                  -> #10                               ;unvalid character
  43.                   moveq.l    #0,d1                    ;exit loop
  44.                   suba.l     a0,a0                    ;error
  45.                  def
  46.                   move.b     d1,(a1)+                 ;copy character
  47.                  eswitch
  48.  
  49.                 until.s ~d1.b
  50.  
  51.                 efunc,a0                              ;return new string pointer
  52.